package com.example.a10928.weifriend.ui.home.menu

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.app.Fragment
import com.example.a10928.weifriend.R
import com.example.a10928.weifriend.adapter.MyViewPageAdapter
import com.example.a10928.weifriend.http.api.VariableName
import com.example.a10928.weifriend.ui.BaseActivity
import com.example.a10928.weifriend.ui.personal_center.AdertFragment
import kotlinx.android.synthetic.main.activity_active_center.*
import java.util.ArrayList

class ActiveCenterActivity : BaseActivity() {
    override fun getContentView(): Int {
        return R.layout.activity_active_center
    }



    override fun initData() {
        supportActionBar?.hide()
        val titleData = ArrayList<String>()
        titleData.add("即将开奖")
        titleData.add("已开奖")
        titleData.add("我的夺宝")

        val fragments = ArrayList<Fragment>()



        fragments.add(getFragment("1"))
        fragments.add(getFragment("2"))
        fragments.add(getFragment("3"))

        val adapter = MyViewPageAdapter(getSupportFragmentManager(), titleData, fragments)

        vp.adapter = adapter
        tablayout.setupWithViewPager(vp)
        tablayout.setTabsFromPagerAdapter(adapter)

        tablayout.isTabIndicatorFullWidth=false


        tv_ruler.setOnClickListener {

            var dialog=ActiveRulerFragment()
            dialog.show(supportFragmentManager,"dialog")
        }

    }

    fun getFragment(type:String): ActiveCenterFragment {

        var fragment= ActiveCenterFragment()
        var bundle=Bundle()
        bundle.putString(VariableName.TYPE,type)
        fragment.arguments=bundle

        return fragment

    }


    override fun initView() {

    }


}
